const { Command } = require("commander");
const program = new Command();
program.version("0.0.1");
program
  .command("clone <source> [destination]")
  .description("clone a repository into a newly created directory")
  .action((source, destination) => {
    console.log("clone command called", source, destination);
  });

program
  .command("create <app-name>")
  .description("create a new project powered by vue-cli-service")
  .action((name) => {
    console.log(name);
  });
/**
 * 嵌套字命令
 *
 * @return  {[type]}  [return description]
 */
function makeHeatCommand() {
  const heat = new Command("server");
  heat.description("启动服务");
  heat.command("jug").action(() => {
    console.log("heat jug");
  });
  heat.command("pot").action(() => {
    console.log("heat pot");
  });
  return heat;
}
program.addCommand(makeHeatCommand());

program.parse(process.argv);
